home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 5732 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.3 KB

  1. Path: I980.ssi.stratus.com!not-for-mail
  2. From: davidm@ssi.stratus.com ()
  3. Newsgroups: comp.lang.c++
  4. Subject: function pointer in C++
  5. Date: 6 Feb 1996 15:16:53 GMT
  6. Organization: Stratus Computer Inc, Marlboro MA
  7. Message-ID: <4f7rd5$6ha@transfer.stratus.com>
  8. Reply-To: David_McReynolds@vos.stratus.com
  9. NNTP-Posting-Host: i980.ssi.stratus.com
  10. X-Newsreader: TIN [UNIX 1.3 950515BETA PL0]
  11.  
  12. I have read the FAQ but do not have it in front of me right now.  If
  13. this question appears in it, my apologies.
  14.  
  15. I am involved with a project to port a ton of C (ANSI and K&R) to
  16. C++.  This is the first step in migration to an OO architecture.
  17.  
  18. The previous programmer used a typedef for a pointer to a function
  19. returning void that looks like this:
  20.  
  21.    typedef void (*PFV)();
  22.  
  23. It is used repeatedly through out the code to point to functions
  24. that require arguements. The compiler complains about the mismatch
  25. in the arguement list  Ex:
  26.  
  27.    static void call_thru (int argc, char *argv[]);
  28.  
  29.    PFV netx_entry_point = call_thru;
  30.  
  31. (Note: they are not all just (int, char**)).
  32.  
  33. I have gone through most of the code and removed the declarations
  34. involving PFV and replaced with something like:
  35.  
  36.    void (*netx_entry_point(int, char**) = call_thru;
  37.  
  38. I would like to know if there is a more elegant or perhaps just plain
  39. better way to handle this that is not obvious to me.
  40.  
  41. Thanks,
  42.  
  43.